package logic

import (
	"context"
	"novel-mgr1/model"

	"novel-mgr1/userrpc/internal/svc"
	"novel-mgr1/userrpc/userrpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type NovelListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewNovelListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NovelListLogic {
	return &NovelListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 小说列表
func (l *NovelListLogic) NovelList(in *userrpc.NovelListRequest) (*userrpc.NovelListResponse, error) {
	// todo: add your logic here and delete this line
	list, count := model.NovelList(model.DB, in)
	return &userrpc.NovelListResponse{
		List:  list,
		Count: count,
	}, nil
}
